package com.thread;

public class TestThread extends Thread {
	 public static void main(String args[])
	    {
	        MyThread mt1 = new MyThread();
	        MyThread mt2 = new MyThread();
	       // MyThread mt3 = new MyThread();
	        new Thread(mt1, "线程1").start();
	        new Thread(mt2, "线程2").start();
	        //new Thread(mt3, "线程2").start();
	    }
	}

	class MyThread implements Runnable
	{
	    private static final  Integer id = new Integer(0);

	    public void run()
	    {
	    	 synchronized(id)
	            {
	        for(int i = 0; i < 30; i ++)
	        {
	        	//System.out.println(id + ".............");
	        	System.out.println(this.getClass().getName());
//	            synchronized(id)
//	            {
	                //int c = id.intValue();
	                //id = new Integer(c);
	                System.out.println(Thread.currentThread().getName() + " id = " + i);
	            }
	        }
	    }
	}
